package projectEuler.net;

public class FactorierAnalize {
	private static int factorIndex;
	private static int[] factorRegister;
	
	public static int[] analysToFactorier(int number){
		initialize();
		findPrimesFactor(number);
		return copyToResult();
	}
	private static void initialize(){
		factorIndex = 0;
		factorRegister = new int[64];
	}
	private static void findPrimesFactor(int number){
		for(int factor=2; number!=1; factor++)
			for(;(number%factor)==0; number/=factor)
				factorRegister[factorIndex++]=factor;
	}
	private static int[] copyToResult(){
		int[] factor = new int[factorIndex];
		for(int i=0; i<factorIndex; i++)
			factor[i]=factorRegister[i];
		return factor;
	}
}
